package com.pxene.hbasetime;

import java.io.IOException;

import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableMapper;
import org.apache.hadoop.io.LongWritable;

public class HBaseTimeCountMapper extends TableMapper<LongWritable,LongWritable> {

	private LongWritable resultKey = new LongWritable();
	private LongWritable resultVal = new LongWritable(1);

	@Override
	protected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException, InterruptedException {
		Cell[] cells = value.rawCells();
		for (Cell cell : cells) {
			resultKey.set(cell.getTimestamp());
			resultVal.set(1);
			context.write(resultKey, resultKey);
		}
		
	}

}